package com.semanticweb.rbac.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ManyToMany;
import javax.validation.constraints.NotNull;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.json.RooJson;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJson
@RooJpaActiveRecord(finders = { "findRolesesByPermissions", "findRolesesByRoleNameEquals", "findRolesesByUsers" })
public class Roles {

    @NotNull
    private String roleName;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Users> users = new HashSet<Users>();

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Permissions> permissions = new HashSet<Permissions>();
}
